<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>this</title>

    <script type="text/javascript">
        //<![CDATA[
        
        window.onload=setObjects;
        
        function setObjects() {
            document.getElementById("personData").firstName.onblur=testValue;
        }
        
        function testValue() {
            alert("Hi " + this.value);
        }
        //]]>    
    </script>
</head>
<body>
    <form id="personData" action="">
        <p>
            First Name: <input type="text" id="firstName" /> <br /> <br />
            Second Name: <input type="text" id="secondName" />
        </p>
    </form>
</body>
</html>